// The Vue build version to load with the `import` command
// (runtime-only or standalone) has been set in webpack.base.conf with an alias.
import Vue from 'vue'
import App from './App'
import router from './router'
import '@/styles/index.scss'
import ElementUI from 'element-ui'
import 'element-ui/lib/theme-chalk/index.css'
import 'normalize.css/normalize.css'
import store from './store'
import {currency} from './utils/currency'
import { date } from './utils/date'
import infiniteScroll from 'vue-infinite-scroll'
Vue.config.productionTip = false
Vue.use(ElementUI)
Vue.use(infiniteScroll)
Vue.filter('currency', currency)
Vue.filter('date', date)

// router.beforeEach((to, from, next) => {
//   const state = localStorage.getItem('userId')
//   console.log(state)
//   if (state === '') {
//     next({path: '/login'})
//   }
//   next()
// })

/* eslint-disable no-new */
new Vue({
  el: '#app',
  router,
  components: { App },
  template: '<App/>',
  store,
  directives: {
    infiniteScroll
  }
})
